<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 整型(整数) ：integer 浮点数(小数) ：float
        let score = '98.5';

        // 1. 字符串转化为 number
        score1 = parseFloat(score);  //98.5
        score2 = parseInt(score);    //98
        console.log(score1,score2);

        // 2. not a number
        score3 = parseInt('剑圣');  // NaN
        console.log(score3);

        // 强制转化为number
        let age = Number('123')
        console.log(typeof age);   // number
    </script>
</body>
</html>